#!/bin/sh

#镜像的名称
IMAGE_NAME="";
#pom.properties和Dockerfile文件位置
APP_HOME="./target/maven-archiver";
DOCKERFILE_HOME="./docker/Dockerfile";
#docker仓库地址
REGISTRY="192.168.1.178:8082";
#docker仓库验证
USERNAME="admin";
PASSWORD="admin123";

#切换根目录到allapp下

JAR="$1/esafe";

#构建
echo "====>image is building ,coman : docker build -t $REGISTRY/$JAR $DOCKERFILE_HOME<====";
ls;
docker build -t $REGISTRY/$JAR -f $DOCKERFILE_HOME .;
echo "====>image build success!<====";

#登陆
docker login $REGISTRY -u$USERNAME -p$PASSWORD;

#推送
echo "====>image is pushing<====";
docker push $REGISTRY/$JAR;
echo "====>image push success!<====";

#清除
echo "====>image is clean<====";
docker rmi $REGISTRY/$JAR;
echo "====>image clean success!<====";
